GOAL: Use R to replicate this set of interactive tables and charts from Our World in Data on life satisfaction across countries.

Self-reported life satisfaction, 2011 to 2022

“Please imagine a ladder, with steps numbered from 0 at the bottom to 10 at the top. The top of the ladder represents the best possible life for you and the bottom of the ladder represents the worst possible life for you. On which step of the ladder would you say you personally feel you stand at this time?”

🔢 Table

TABLE TO BE CREATED HERE

🌎 Map

📈 Simple Chart

CHART TO BE CREATED HERE

📈 Advanced Chart

One problem with the simple chart on the previous tab is that the countries are fixed. It would be better if the user could select the countries they want to see. This is not possible with plotly alone, but with the crosstalk package and some custom JavaScript, we can achieve this, as demonstrated below.

This is simply a demonstration for you, you do not need to work on this for your assignment. You may want to come back to this when you need such functionality in your own projects.

For more information on how we achieved this, see this Stack Overflow question.

Data source: World Happiness Report

OurWorldInData.org/happiness-and-life-satisfaction | CC BY